<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/WEB-TAG/platForm.tld" prefix="PF"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<PF:basePath/>">
		<title>动态数据查询</title>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<jsp:include page="/WEB-FACE/conf/includeH.jsp"></jsp:include>
	</head>
	<body class="easyui-layout">
		<div data-options="region:'north',border:false">
			<form id="dom_report_search" action="admin/FarmFormsQueryReport.do"
				method="post">
				<input type="hidden" name="query.ruleText" id="query_ruleText">
				<input type="hidden" name="ids" value="${ids}">
			</form>
			<form id="searchQueryForm">
				<table class="editTable">
					<c:forEach items="${ruleTable}" var="nodeTr">
						<tr>
							<c:forEach items="${nodeTr}" var="nodeTd">
								<c:if test="${nodeTd.id==null}">
									<td class="title">
									</td>
									<td>
									</td>
								</c:if>
								<c:if test="${nodeTd.id!=null}">
									<td class="title">
										${nodeTd.title}:
									</td>
									<td>
										<c:if test="${nodeTd.type=='1'}">
											<!-- 文本 -->
											<input type="text" name="${nodeTd.code}:${nodeTd.sign}" style="width: 120px;">
										</c:if>
										<c:if test="${nodeTd.type=='2'}">
											<!-- 枚举 -->
											<select name="${nodeTd.code}:${nodeTd.sign}" style="width: 120px;">
												<option value=""></option>
												<c:forEach items="${nodeTd.enums}" var="entry">
													<option value="${entry.key}">
														${entry.value}
													</option>
												</c:forEach>
											</select>
										</c:if>
										<c:if test="${nodeTd.type=='3'}">
											<!-- 数据字段 -->
											<select name="${nodeTd.code}:${nodeTd.sign}" style="width: 120px;">
												<option value=""></option>
												<c:if test="${nodeTd.typepara!=null&&nodeTd.typepara!=''}">
													<PF:OptionDictionary index="${nodeTd.typepara}"
														isTextValue="0" />
												</c:if>
											</select>
										</c:if>
										<c:if test="${nodeTd.type=='4'}">
											<!-- 日历 -->
											<input name="${nodeTd.code}:${nodeTd.sign}" type="text" style="width: 120px;"
												class="easyui-datebox" ></input>
										</c:if>
									</td>
								</c:if>
							</c:forEach>
						</tr>
					</c:forEach>
					<tr style="text-align: center;">
						<td colspan="6">
							<a id="a_search" href="javascript:void(0)"
								class="easyui-linkbutton" iconCls="icon-search">查询</a>
							<a id="a_reset" href="javascript:void(0)"
								class="easyui-linkbutton" iconCls="icon-reload">清除条件</a>
							<c:if test="${entity.reportable=='1'}">
								<a id="a_report" href="javascript:void(0)"
									class="easyui-linkbutton" iconCls="icon-report">导出excel</a>
							</c:if>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div data-options="region:'center',border:false">
			<table id="dataQueryGrid">
				<c:if test="${!empty titles}">
					<thead data-options="frozen:true">
						<tr>
							<c:forEach items="${titles}" var="title">
								<c:if test="${title.fixis=='1'}">
									<th
										data-options="align:'${title.aligntype}',order:'${title.sorttype=='ASC'?'ASC':'DESC'}',field:'${title.fieldname}',width:${title.width},sortable:${title.sortable=='1'?'true':'false'}">
										${title.title}
									</th>
								</c:if>
							</c:forEach>
						</tr>
					</thead>
				</c:if>
				<thead>
					<tr>
						<c:forEach items="${titles}" var="title">
							<c:if test="${title.fixis=='0'}">
								<th field="${title.fieldname}"
									data-options="align:'${title.aligntype}',order:'${title.sorttype=='ASC'?'ASC':'DESC'}',width:${title.width},sortable:${title.sortable=='1'?'true':'false'}"
									width="${title.width}">
									${title.title}
								</th>
							</c:if>
						</c:forEach>
					</tr>
				</thead>
			</table>
		</div>
	</body>
	<script type="text/javascript">
	var url_searchActionQuery = "admin/FarmFormsQuery.do?ids=${ids}";//查询URL
	var gridQuery;//数据表格对象
	var searchQuery;//条件查询组件对象
	$(function() {
		//初始化数据表格
		gridQuery = $('#dataQueryGrid').datagrid( {
			url : url_searchActionQuery,
			fit : true,
			fitColumns : ${entity.fitcolumns=='1'?'true':'false'},
			pagination : true,
			closable : true,
			checkOnSelect : true,
			border:false,
			striped : true,
			rownumbers : true,
			ctrlSelect : true,
			pageSize:${entity.pagesize},
			pageList:[10,20,50,100],
			nowrap:${entity.nowrap=='1'?'true':'false'}
		});
		//初始化条件查询
		searchQuery = $('#searchQueryForm').searchForm( {
			gridObj : gridQuery
		});
		$('#a_report').bind('click',function(){
			var str = $('#searchQueryForm').searchForm().arrayStr();
			$('#query_ruleText').val(str);
			$('#dom_report_search').submit();
		});
	});
</script>
</html>